const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
  entry: './src/app.js',
  mode: 'production',
  output: {
    filename: "autoLandingPage.js",
    library: "autoLandingPage",
    libraryTarget: 'commonjs2' // 定义打包方式Universal Module Definition,同时支持在CommonJS、AMD和全局变量使用
  },
  plugins: [
    new CopyWebpackPlugin([
      {
        from: path.resolve(__dirname, "src/template"),
        to: 'template'
      },
    ])
  ],
  resolve: {
    // 解析模块请求的选项
    // （不适用于对 loader 解析）
    modules: [
      "node_modules",
      path.resolve(__dirname, "src")
    ],
    // 用于查找模块的目录
    extensions: [".js", ".ejs"]
  },
  target: 'async-node',
  node: {
    __dirname: false
  }
};
